﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;
using System.Data.SqlClient;
using System.Xml;


namespace ScrumMagic
{
    /// <summary>
    /// Interaction logic for TaskListRibbon.xaml
    /// </summary>
    public partial class ProjectListRibbon : Window
    {
        public ProjectListRibbon()
        {
            InitializeComponent();
        }

        private void OnRibbonCommandCanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        private void RibbonCommandFind(object sender, EventArgs e)
        {
            if (FindButtonClicked != null)
            {
                FindButtonClicked(sender, new TextEventArgs(textBox.Text));
            }
        }

        public event EventHandler<TextEventArgs> FindButtonClicked;

        public event EventHandler AddButtonClicked;

        private void RibbonAddButtonClick(object sender, RoutedEventArgs e)
        {
            if (AddButtonClicked != null)
            {
                AddButtonClicked(sender, e);
            }
        }

        private void RibbonButton_Click_1(object sender, RoutedEventArgs e)
        {


            //LoginWindow windo = (LoginWindow)this;
            ////windo.MWnd.FormToOpenProjectListWind.dataGrid1

            //DataRowView row = (DataRowView)windo.MWnd.FormToOpenProjectListWind.dataGrid1.SelectedItem;


            //string rowSt = row[0].ToString();
            //SqlCommand command = DBController.MainConnection.CreateCommand();
            //command.CommandType = System.Data.CommandType.Text;
            //string RealStartDate = row[5].ToString().Substring(6, 4) + row[5].ToString().Substring(2, 4) + row[5].ToString().Substring(0, 2);
            ////MessageBox.Show(RealStartDate);
            //command.CommandText = "Update Project SET Version_Id='" + row[1].ToString() +
            //                    "', Name ='" + row[2].ToString() + "', Project_id='" +
            //                   row[3].ToString() + "', Status_Id='" + row[4].ToString() +
            //                   "',Start_Date='" + RealStartDate + "', Comment='" +
            //                   row[6].ToString() + "' where Id='" + row[0].ToString() + "';";

            //SqlDataReader rdr = command.ExecuteReader();

        }
    }
}
